import test from '../../js/index';
import './css/index.css';
import '../../css/index.scss';

import bg from './assets/bg.png';

function getComponent() {
  return import(/* webpackPrefetch: true */ 'lodash').then(({ default: _ }) => {
    let element = document.createElement('div');

    element.classList = 'test comm-test';

    element.innerHTML = _.join(['Hello', 'webpack'], ' ');

    return element;

  }).catch(error => 'An error occurred while loading the component');
}

function createImg() {
  let img = document.createElement('img');
  img.src = bg;
  document.body.appendChild(img); 
}

setTimeout(function() {
  test();

  createImg();

  getComponent().then(component => {
    document.body.appendChild(component);
  });
}, 3000);
